fix: emit nnUNet store_true flags as bare CLI args in nnUNetV2Runner - #8968
Conversation
…command Boolean kwargs such as --c, --val, --use_compressed and --disable_checkpointing were forwarded as "--c True", which nnUNetv2_train rejects with "unrecognized arguments: True". Emit the flag alone when the value is True and omit it when False, leaving non-boolean args (e.g. -p) unchanged. Fixes Project-MONAI#8237 Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe pull request updates ChangesnnUNet runner argument handling
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Is this an alternative to #8944 or should we merge that one first? |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
monai/apps/nnunet/nnunetv2_runner.py (1)
765-765: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse
val=Truehere
validate_single_model()forwardsonly_run_validation=True, which becomes--only_run_validationon thennUNetv2_trainCLI. That command uses--valfor validation-only mode, so this path still passes an unrecognized flag.🐛 Proposed fix
- self.train_single_model(config=config, fold=fold, only_run_validation=True, **kwargs) + self.train_single_model(config=config, fold=fold, val=True, **kwargs)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@monai/apps/nnunet/nnunetv2_runner.py` at line 765, The validation-only path in validate_single_model is forwarding the wrong flag through train_single_model, causing nnUNetv2_train to receive --only_run_validation instead of the expected validation mode flag. Update the call in validate_single_model to pass val=True rather than only_run_validation=True, and ensure the train_single_model / CLI argument mapping uses the val parameter so validation-only runs invoke the correct nnUNetv2_train option.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@monai/apps/nnunet/nnunetv2_runner.py`:
- Line 765: The validation-only path in validate_single_model is forwarding the
wrong flag through train_single_model, causing nnUNetv2_train to receive
--only_run_validation instead of the expected validation mode flag. Update the
call in validate_single_model to pass val=True rather than
only_run_validation=True, and ensure the train_single_model / CLI argument
mapping uses the val parameter so validation-only runs invoke the correct
nnUNetv2_train option.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 02927779-bfeb-4b26-b032-67292bec7c9f
📒 Files selected for processing (1)
monai/apps/nnunet/nnunetv2_runner.py
ea63acf to
559864f
Compare
May you please merge that first? also happy to jsut add this commit onto that. |
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
The generic boolean-flag handling supersedes the explicit allowlist introduced by Project-MONAI#8944, leaving store_true_flags unused. Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
Fixes #8237 .
Description
The runner passed boolean flags like
--cthrough as--c True, but nnU-Net treats these asstore_trueflags that take no value, so it errored out withunrecognized arguments: True. Now we emit just the bare flag when it's set, drop it when it isn't, and leave the other args alone.Types of changes
Summary by CodeRabbit